package cn.edu.cqupt.cxcy.action;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.edu.cqupt.cxcy.dto.TeacImpl;
import cn.edu.cqupt.cxcy.model.Team;

/**
 * 导师后台主页
 * @author Dancer-mno
 * @date 2015年10月17日
 */
public class TeacIndex extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doPost(request, response);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html;charset=utf-8");
		HttpSession session=request.getSession();
		session=request.getSession();
		List<Object> list=(List<Object>)session.getAttribute("user");
		int tea_id=(int)list.get(1);//从session中所取得的教师id
		String type=request.getParameter("type");
		List<Team> show = null;
		if("ask".equals(type)) {
			show=new TeacImpl().ShowOfTeam(tea_id, 1, 1); //团队请求
		} else {
			show=new TeacImpl().ShowOfTeam(tea_id, 2, 2); //知道团队列表
			//System.out.println(show.get(0).getTe_explain());
		}
		request.setAttribute("teamshow", show);
		request.getRequestDispatcher("teacher.jsp").forward(request, response);
	}

}
